using System;
using System.Collections;
using Nullables;

namespace CoreIMSEE.Core.Controller
{
	/// <summary>
	/// Summary description for InfrastructureProperties.
	/// </summary>
	/// 
	[Obsolete("in favour of IExecutionContext")]
	public sealed class InfrastructureProperties
	{
		private const string infrastructurePrefix="infrastructure"; 
		private IDictionary executionContext;
	
		public string CommandArgument
		{
			get {return executionContext[infrastructurePrefix+".commandArgument"] as string;}
		}	

		public string CommandName
		{
			get {return executionContext[infrastructurePrefix+".commandName"] as string;}
		}

		public string CurrentExecutionContextPrefix
		{
			get {return executionContext[infrastructurePrefix+".CurrentExecutionContextPrefix"] as string;}
		}

		public IConfiguration CurrentConfiguration
		{
			get {return executionContext[infrastructurePrefix+".CurrentConfiguration"] as IConfiguration;}
		}

		public string PostBackSourceControl
		{
			get {return executionContext[infrastructurePrefix+".PostBackSourceControl"] as string;}
		}

		public string ActionName
		{
			get {return executionContext[infrastructurePrefix+".ActionName"] as string;}
		}

		public bool IsPostBack
		{
			get { return (bool)executionContext[infrastructurePrefix+".IsPostBack"];}	
		}

/*
		public NullableBoolean IsValid
		{
			get
			{
				object isValid=executionContext[infrastructurePrefix+".IsValid"];
				if (isValid==null)
				{
					return null;
				}
				return (bool)isValid;
			}
		}
*/

		public InfrastructureProperties(IDictionary executionContext)
		{
			if (executionContext==null)
			{
				throw new NullReferenceException("Execution context should not be null.");
			}
			this.executionContext=executionContext;
		}
	}
}
